package net.mysoft.budgetsoft.system.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.apache.log4j.Logger;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**   
 *  
 * @author dagongPGP v1.0 
 * @link <a href=http://www.mysoft.net>北京大公信软科技有限公司</a> 
 *  
 * @version $Revision: 1.00  $Date: 2013-07-10 15:42:17 
 */
//@Entity
//@Table(name="FlowTaskNode")
public class TFlowTaskNode implements java.io.Serializable {  
	private static final Logger logger = Logger.getLogger(TFlowTaskNode.class);

	
    private String ftn_ID;
    private Integer ftn_Status;
    private TFlow flow;
    private TFlowTemplateNode flowTemplateNode;
    private String fln_PID;
    private String ftn_UserCode;
    private String ftn_File;
    private String ftn_FromFile;
    private String ftn_FromText;
    private String ftn_Text;
    private String ftn_TransactCue;
    private Integer ftn_HandleResult;
    private String ftn_HandleUserCode;
    private java.util.Date ftn_HandleBeginTime;
    private java.util.Date ftn_HandleEndTime;
    private Integer ftn_Deadline;
    private Integer ftn_RemindInterval;
    private String ftn_Assignee;
    private String ftn_FormUrl;
    private String ftn_IndeptRoleCode;
    private String ftn_IndeptComCode;
    private String ftn_IndeptUserCode;
    private Integer ftn_Index;
    private Integer ftn_State;
    private TFlowNodeClass flowNodeClass;
    private Integer ftn_Type;
    private String ftn_Name_en;
    private String ftn_Name_cn;
    private String ftn_DetractCode;
    private String ftn_TextName;
    private Integer ftn_XiangMuJD;
    private Integer ftn_UserNum;
    private Integer ftn_MustPass;
    private String ftn_ReturnTo;

    private String xiangMuJBXXBH;
    private String renWuJBXXBH;
    private String xiangMuYCLX;
    
    @ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "FTNT_ID")
    public TFlowTemplateNode getFlowTemplateNode() {
		return flowTemplateNode;
	}
	public void setFlowTemplateNode(TFlowTemplateNode flowTemplateNode) {
		this.flowTemplateNode = flowTemplateNode;
	}
	public TFlowTaskNode(){
    	super();
    }
    public TFlowTaskNode(TFlow flow,TFlowTemplateNode templateNode,String userID,int status,String renWuJBXXBH,String xiangMuJBXXBH){
    	logger.info("new TFlowTaskNode:flow="+flow+".templateNode="+templateNode+".userID="+userID+".status="+status+".renWuJBXXBH="+renWuJBXXBH+".xiangMuJBXXBH="+xiangMuJBXXBH);
    	//SessionInfo sessionInfo = (SessionInfo) ServletActionContext.getRequest().getSession().getAttribute(ResourceUtil.getSessionInfoName());
    	String userId = userID;
    	this.setFlow(flow);
    	this.setFlowTemplateNode(templateNode);
    	//this.setFtn_Assignee(userId);  代理人
    	this.setFtn_UserCode(userId);
    	
    	this.setFtn_HandleBeginTime(new Date());
    	//this.setFtn_Deadline(flowNode.getFln_Deadline());
    	//this.setFtn_RemindInterval(flowNode.getFln_RemindInterval());
    	this.setFtn_Status(status);
    	this.setFtn_TransactCue("");
    	this.setFtn_UserCode(userID);
    	
 //   	this.setFtn_Deadline(flowNode.getFln_Deadline());
    	this.setFtn_DetractCode(templateNode.getFtn_DetractCode());
    	this.setFtn_FormUrl(templateNode.getFtn_FormUrl());
    	this.setFtn_IndeptComCode(templateNode.getFtn_IndeptComCode());
    	this.setFtn_IndeptRoleCode(templateNode.getFtn_IndeptRoleCode());
    	this.setFtn_IndeptUserCode(templateNode.getFtn_IndeptUserCode());
    	this.setFtn_Index(templateNode.getFtn_Index());
    	this.setFtn_Name_cn(templateNode.getFtn_Name_cn());
    	this.setFtn_Name_en(templateNode.getFtn_Name_en());
  //  	this.setFtn_RemindInterval(flowNode.getFln_RemindInterval());
    	this.setFtn_State(templateNode.getFtn_State());
    	this.setFtn_TextName(templateNode.getFtn_TextName());
    	this.setFtn_Type(templateNode.getFtn_Type());
    	
    	this.setFln_PID(templateNode.getFtn_PID());
    	this.setFlowNodeClass(templateNode.getFlowNodeClass());
    	if(renWuJBXXBH!=null&&!"".equals(renWuJBXXBH)&&!"null".equalsIgnoreCase(renWuJBXXBH)){
    		this.setRenWuJBXXBH(renWuJBXXBH);
    	}
    	if(xiangMuJBXXBH!=null&&!"".equals(xiangMuJBXXBH)&&!"null".equalsIgnoreCase(xiangMuJBXXBH)){
        	this.setXiangMuJBXXBH(xiangMuJBXXBH);
    	}
    	this.setFtn_XiangMuJD(templateNode.getFtn_XiangMuJD());
    	
    	this.setFtn_MustPass(templateNode.getFtn_MustPass());
    	this.setFtn_ReturnTo(templateNode.getFtn_ReturnTo());
    	this.setFtn_UserNum(templateNode.getFtn_UserNum());
    }
    
	@Id 
	@GeneratedValue(generator = "IDGenerator")
	@GenericGenerator(name = "IDGenerator", strategy = "net.mysoft.framework.util.IDGenerator", 
			parameters = { @Parameter(value = "SEQ_FTN", name = "seq")})
    @Column(name="FTN_ID", unique=true, nullable=false)
    public String getFtn_ID(){
    	return this.ftn_ID;
    }
    
    public void setFtn_ID(String fTN_ID){
    	this.ftn_ID = fTN_ID;
    }
    @Column(name="FTN_UserNum",nullable=true)
	public Integer getFtn_UserNum() {
		return ftn_UserNum;
	}
	public void setFtn_UserNum(Integer ftn_UserNum) {
		this.ftn_UserNum = ftn_UserNum;
	}
	@Column(name="FTN_MustPass",nullable=true)
	public Integer getFtn_MustPass() {
		return ftn_MustPass;
	}
	public void setFtn_MustPass(Integer ftn_MustPass) {
		this.ftn_MustPass = ftn_MustPass;
	}
	@Column(name="FTN_ReturnTo",nullable=true)
	public String getFtn_ReturnTo() {
		return ftn_ReturnTo;
	}
	public void setFtn_ReturnTo(String ftn_ReturnTo) {
		this.ftn_ReturnTo = ftn_ReturnTo;
	}
	@Column(name="XiangMuYCLX",nullable=true)
	public String getXiangMuYCLX() {
		return xiangMuYCLX;
	}
	public void setXiangMuYCLX(String xiangMuYCLX) {
		this.xiangMuYCLX = xiangMuYCLX;
	}
	@Column(name="FTN_XiangMuJD",nullable=true)
    public Integer getFtn_XiangMuJD() {
		return ftn_XiangMuJD;
	}
	public void setFtn_XiangMuJD(Integer ftn_XiangMuJD) {
		this.ftn_XiangMuJD = ftn_XiangMuJD;
	}

	@Column(name="FTN_Status")
    public Integer getFtn_Status(){
    	return this.ftn_Status;
    }
	public void setFtn_Status(Integer ftn_Status){
    	this.ftn_Status = ftn_Status;
    }
    
    @ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "FLO_ID")
    public TFlow getFlow() {
		return flow;
	}

	public void setFlow(TFlow flow) {
		this.flow = flow;
	}

	@Column(name = "FTN_HandleResult",nullable=true)
    public Integer getFtn_HandleResult() {
		return ftn_HandleResult;
	}
	public void setFtn_HandleResult(Integer ftn_HandleResult) {
		this.ftn_HandleResult = ftn_HandleResult;
	}

	@Column(name = "FLN_PID")
	public String getFln_PID() {
		return fln_PID;
	}
	public void setFln_PID(String fln_PID) {
		this.fln_PID = fln_PID;
	}
 
    @Column(name="FTN_UserCode",nullable=true)
    public String getFtn_UserCode(){
    	return this.ftn_UserCode;
    }


	public void setFtn_UserCode(String fTN_UserCode){
    	this.ftn_UserCode = fTN_UserCode;
    }
    
    @Column(name="FTN_File",nullable=true)
    public String getFtn_File(){
    	return this.ftn_File;
    }
    
    public void setFtn_File(String fTN_File){
    	this.ftn_File = fTN_File;
    }
    
    @Column(name="FTN_FromFile",nullable=true)
    public String getFtn_FromFile(){
    	return this.ftn_FromFile;
    }
    
    public void setFtn_FromFile(String fTN_FromFile){
    	this.ftn_FromFile = fTN_FromFile;
    }
    
    @Column(name="FTN_FromText",nullable=true)
    public String getFtn_FromText(){
    	return this.ftn_FromText;
    }
    
    public void setFtn_FromText(String fTN_FromText){
    	this.ftn_FromText = fTN_FromText;
    }
    
    @Column(name="FTN_Text",nullable=true)
    public String getFtn_Text(){
    	return this.ftn_Text;
    }
    
    public void setFtn_Text(String fTN_Text){
    	this.ftn_Text = fTN_Text;
    }
    
    @Column(name="FTN_TransactCue",nullable=true)
    public String getFtn_TransactCue(){
    	return this.ftn_TransactCue;
    }
    
    public void setFtn_TransactCue(String fTN_TransactCue){
    	this.ftn_TransactCue = fTN_TransactCue;
    }
    @Column(name="FTN_HandleUserCode",nullable=true)
    public String getFtn_HandleUserCode() {
		return ftn_HandleUserCode;
	}
	public void setFtn_HandleUserCode(String ftn_HandleUserCode) {
		this.ftn_HandleUserCode = ftn_HandleUserCode;
	}
	@Column(name="FTN_HandleBeginTime",nullable=true)
    public java.util.Date getFtn_HandleBeginTime(){
    	return this.ftn_HandleBeginTime;
    }
    
    public void setFtn_HandleBeginTime(java.util.Date fTN_HandleBeginTime){
    	this.ftn_HandleBeginTime = fTN_HandleBeginTime;
    }
    
    @Column(name="FTN_HandleEndTime",nullable=true)
    public java.util.Date getFtn_HandleEndTime(){
    	return this.ftn_HandleEndTime;
    }
    
    public void setFtn_HandleEndTime(java.util.Date fTN_HandleEndTime){
    	this.ftn_HandleEndTime = fTN_HandleEndTime;
    }
    
    @Column(name="FTN_Deadline",nullable=true)
    public Integer getFtn_Deadline(){
    	return this.ftn_Deadline;
    }
    
    public void setFtn_Deadline(Integer fTN_Deadline){
    	this.ftn_Deadline = fTN_Deadline;
    }
    
    @Column(name="FTN_RemindInterval",nullable=true)
    public Integer getFtn_RemindInterval(){
    	return this.ftn_RemindInterval;
    }
    
    public void setFtn_RemindInterval(Integer fTN_RemindInterval){
    	this.ftn_RemindInterval = fTN_RemindInterval;
    }
    
    @Column(name="FTN_Assignee",nullable=true)
    public String getFtn_Assignee(){
    	return this.ftn_Assignee;
    }
    
    public void setFtn_Assignee(String fTN_Assignee){
    	this.ftn_Assignee = fTN_Assignee;
    }
    
    @Column(name="FTN_FormUrl",nullable=true)
    public String getFtn_FormUrl(){
    	return this.ftn_FormUrl;
    }
    
    public void setFtn_FormUrl(String fTN_FormUrl){
    	this.ftn_FormUrl = fTN_FormUrl;
    }
    
    @Column(name="FTN_IndeptRoleCode",nullable=true)
    public String getFtn_IndeptRoleCode(){
    	return this.ftn_IndeptRoleCode;
    }
    
    public void setFtn_IndeptRoleCode(String fTN_IndeptRoleCode){
    	this.ftn_IndeptRoleCode = fTN_IndeptRoleCode;
    }
    
    @Column(name="FTN_IndeptComCode",nullable=true)
    public String getFtn_IndeptComCode(){
    	return this.ftn_IndeptComCode;
    }
    
    public void setFtn_IndeptComCode(String fTN_IndeptComCode){
    	this.ftn_IndeptComCode = fTN_IndeptComCode;
    }
    
    @Column(name="FTN_IndeptUserCode")
    public String getFtn_IndeptUserCode(){
    	return this.ftn_IndeptUserCode;
    }
    
    public void setFtn_IndeptUserCode(String fTN_IndeptUserCode){
    	this.ftn_IndeptUserCode = fTN_IndeptUserCode;
    }
    
    @Column(name="FTN_Index")
    public Integer getFtn_Index(){
    	return this.ftn_Index;
    }
    
    public void setFtn_Index(Integer fTN_Index){
    	this.ftn_Index = fTN_Index;
    }
    
    @Column(name="FTN_State")
    public Integer getFtn_State(){
    	return this.ftn_State;
    }
    
    public void setFtn_State(Integer fTN_State){
    	this.ftn_State = fTN_State;
    }
    

    @ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "FTN_Class")
    public TFlowNodeClass getFlowNodeClass() {
		return flowNodeClass;
	}
	public void setFlowNodeClass(TFlowNodeClass flowNodeClass) {
		this.flowNodeClass = flowNodeClass;
	}
	@Column(name="FTN_Type")
    public Integer getFtn_Type(){
    	return this.ftn_Type;
    }
    
    public void setFtn_Type(Integer fTN_Type){
    	this.ftn_Type = fTN_Type;
    }
    
    @Column(name="FTN_Name_en")
    public String getFtn_Name_en(){
    	return this.ftn_Name_en;
    }
    
    public void setFtn_Name_en(String fTN_Name_en){
    	this.ftn_Name_en = fTN_Name_en;
    }
    
    @Column(name="FTN_Name_cn")
    public String getFtn_Name_cn(){
    	return this.ftn_Name_cn;
    }
    
    public void setFtn_Name_cn(String fTN_Name_cn){
    	this.ftn_Name_cn = fTN_Name_cn;
    }
    
    @Column(name="FTN_DetractCode")
    public String getFtn_DetractCode(){
    	return this.ftn_DetractCode;
    }
    
    public void setFtn_DetractCode(String fTN_DetractCode){
    	this.ftn_DetractCode = fTN_DetractCode;
    }
    
    @Column(name="FTN_TextName")
    public String getFtn_TextName(){
    	return this.ftn_TextName;
    }
    
    public void setFtn_TextName(String fTN_TextName){
    	this.ftn_TextName = fTN_TextName;
    }
    
    @Column(name="XiangMuJBXXBH")
    public String getXiangMuJBXXBH(){
    	return this.xiangMuJBXXBH;
    }
    
    public void setXiangMuJBXXBH(String xiangMuJBXXBH){
    	this.xiangMuJBXXBH = xiangMuJBXXBH;
    }
    
    @Column(name="RenWuJBXXBH")
    public String getRenWuJBXXBH(){
    	return this.renWuJBXXBH;
    }
    
    public void setRenWuJBXXBH(String renWuJBXXBH){
    	this.renWuJBXXBH = renWuJBXXBH;
    }
    
	
    @Override
    public int hashCode() {
    	int prime = 0;
        prime +=this.getFtn_ID().hashCode();
        return prime;
    }

    @Override
    public boolean equals(Object obj) {
    	boolean isEquals = false;
    	if(obj!=null&&this.getClass()==obj.getClass()){
    		TFlowTaskNode clazz = (TFlowTaskNode)obj;
            if(clazz.getFtn_ID().equals(this.getFtn_ID()))
            	isEquals = true;
    		return isEquals;
    	}
        return isEquals;
    }

}